x=eval(input())
y=eval(input())
k=0
i=0
while i<y:
    if (i+1)%7==0:
        i=i+2
        k+=1
    else:
        i=i+1
        k+=1
    if k%x==0:
        k=0
print(k)